
import * as THREE from 'three'

type _CameraParams = {
    fovY: number,
    near: number,
    far: number
}

export enum CameraType {
    Perspective
}

export const DEFAULT_PERSPECTIVE_CAMERA_PARAMS: _CameraParams = {
    fovY: 60,
    near: 0.1,
    far: 1000
}

export default class {
    private _threeCamera: THREE.Camera;
    private _cameraType: CameraType;

    constructor(cameraType: CameraType, param: _CameraParams) {
        this._cameraType = cameraType;

        switch (cameraType) {
            case (CameraType.Perspective):
                this._threeCamera = new THREE.PerspectiveCamera(
                    param.fovY, 1.777, param.near, param.far
                )
        }
    }

    _resetCameraAspect(aspect: number) {
        (this._threeCamera as THREE.PerspectiveCamera).aspect = aspect;
    }

    _rawCamera(): THREE.Camera {
        return this._threeCamera;
    }
}
